package com.it.nestedscrollview;

import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.widget.ArrayAdapter;

import java.util.ArrayList;
import java.util.List;

public class MainActivity4_DPListView extends AppCompatActivity {
    List<String> mData;
    private Toolbar mToolbar;
    private AppBarLayout mAppbar;
    private RecyclerView mRecyclerView;
    private DPListView mListview;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main4);
        initData(1);
        initView();

    }


    private void initData(int pager) {
        mData = new ArrayList<>();
        for (int i = 1; i < 50; i++) {
            mData.add("pager" + pager + " 第" + i + "个item");
        }
    }

    private void initView() {
        //设置ToolBar
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        toolbar.setTitle("这是AppBarLayout");
        setSupportActionBar(toolbar);//替换系统的actionBar
        mListview = (DPListView) findViewById(R.id.listview);
        ArrayAdapter arrayAdapter =
                new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mData);
        mListview.setAdapter(arrayAdapter);
        arrayAdapter.notifyDataSetChanged();

    }


}
